package switchviz.core.view;

import org.jdom.Element;

import switchviz.gui.component.IXMLFilter;

public class ViewXMLFilter extends IXMLFilter
{

	public ViewXMLFilter()
	{
		this.allowName(ViewTree.VIEWNODE);
		this.allowName(ViewTree.GAUGENODE);
	}

	public String Extract(Element rawNode) 
	{
		if(ViewTree.VIEWNODE.equals(rawNode.getName()))
			return rawNode.getChildText(ViewTree.VIEWNAMENODE);

		if(ViewTree.GAUGENODE.equals(rawNode.getName()))
			return rawNode.getAttributeValue(ViewTree.GAUGEATTNAME);
		
		return rawNode.getName();
	}

}
